package com.lpf.handler1.server;

import com.lpf.handler1.MyByteToLongDecoder02;
import com.lpf.handler1.MyLongToByteEncoder;
import com.lpf.handler1.MyLongToStringDecoder;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;

public class MyServerInitializer extends ChannelInitializer<SocketChannel> {

    @Override
    protected void initChannel(SocketChannel ch) throws Exception {

        ChannelPipeline pipeline = ch.pipeline();

        // 添加自定义编解码器
        //pipeline.addLast(new MyByteToLongDecoder());
        pipeline.addLast(new MyByteToLongDecoder02());

        pipeline.addLast(new MyLongToStringDecoder());

        pipeline.addLast(new MyLongToByteEncoder());



        pipeline.addLast(new MyServerHandler());
    }
}